package web.gkw.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class Test extends ActionSupport {
	private String test;

	public String getTest() {
		return test;
	}

	public void setTest(String test) {
		this.test = test;
	}
	
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println("OK! I'm here^_^  ");
		HttpServletRequest request = ServletActionContext.getRequest();
		test = request.getParameter("text");
		System.out.println(test);
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();
		String responseText = test.concat(" had been reached!");
		out.println(responseText);
		out.flush();
		out.close();
		return null;
	}
}
